package ru.amse.tsyganov.jumleditor.view.lines;



public abstract class MiddleLine extends Line {
	
	private Line fromLine;
	
	private Line toLine;
	
	public MiddleLine() {
	}
	
	public boolean isHorizontal() {
		assert fromLine.isHorizontal() == toLine.isHorizontal();
		return !fromLine.isHorizontal();
	}

	public void setFromLine(Line fromLine) {
		this.fromLine = fromLine;
	}

	public void setToLine(Line toLine) {
		this.toLine = toLine;
	}

	protected Line getFromLine() {
		return fromLine;
	}

	protected Line getToLine() {
		return toLine;
	}

	public static MiddleLine createNewMiddleLine(boolean isHorizontal) {
		
		return isHorizontal ? 
				new HorizontalMiddleLine() :
					new VerticalMiddleLine();
	}
}
